class Solution {
public:
    TreeNode* invertTree(TreeNode* root) {
        if(root==nullptr) return nullptr;
        TreeNode*newleft=invertTree(root->left);
        TreeNode*newright=invertTree(root->right);
        root->left=newright;
        root->right=newleft;

        return root;
        

    }
};